extension Shape {
    var numberOfSides: Int {
        switch self {
        case .Triangle:
            return 3
        case .Square:
            return 4
        // 继续处理其他情况...
        }
    }
}